//
//  HWAddressManagementController.m
//  HWanGame
//
//  Created by 陈道斌 on 2019/10/21.
//  Copyright © 2019 Chendaobin. All rights reserved.
//

#import "HWAddressManagementController.h"
#import "HWDiZhiTableViewCell.h"
#import "HWNewAddressViewController.h"

@interface HWAddressManagementController ()<UITableViewDataSource,UITableViewDelegate>
@property(strong,nonatomic) UITableView *mainaTableVie;
@property(strong,nonatomic) UIView *lowerPartView;


@end

@implementation HWAddressManagementController




-(UITableView *)mainaTableVie {

    if  (_mainaTableVie == nil) {

        _mainaTableVie = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, kScreenH-44-CF_TabbarSafeBottomMargin) style:UITableViewStylePlain];
        _mainaTableVie.delegate = self;
        _mainaTableVie.dataSource = self;
        _mainaTableVie.separatorStyle = UITableViewCellSeparatorStyleNone;
        
        _mainaTableVie.backgroundColor = [UIColor whiteColor];
        _mainaTableVie.backgroundColor = RGB(241, 242, 244);
        
    }
    return   _mainaTableVie ;
    

}








- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self setupUI];
    
}

// 设置UI
- (void)setupUI {
    
    self.navigationItem.title = @"地址管理";
    [self.view addSubview:self.mainaTableVie];
    [self addLowerPartView];
    
    
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    return  10;
    
    
}



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    static NSString *cellID = @"cellID";
    
    
    HWDiZhiTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    
    if (!cell) {
        cell = [[NSBundle mainBundle]loadNibNamed:@"HWDiZhiTableViewCell" owner:nil options:nil].firstObject;
    }
    cell.backgroundColor  = [UIColor whiteColor];
    cell.selectionStyle  = UITableViewCellSelectionStyleNone;
    
    return cell;
    
}


- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    
   
    
    return  71;
    
}


// 添加低部UIview
- (void)addLowerPartView {
    
    self.lowerPartView = [[UIView alloc]initWithFrame:CGRectMake(0, kScreenH-44-CF_TabbarSafeBottomMargin, kScreenW, 44+CF_TabbarSafeBottomMargin)];
    // self.lowerPartView.backgroundColor = [UIColor yellowColor];
    self.lowerPartView.backgroundColor = RGB(241, 242, 244);
    [self.view addSubview:self.lowerPartView];
    
    UIButton *butt  = [UIButton setButtonWithFrame:CGRectMake(15, 4, kScreenW-30, 36) Title:@"新增地址" Image:nil Font:14 Color:RGB(255, 255, 255) Target:self Selector:@selector(buttonTap)];
    butt.backgroundColor = blueBackgroundBT;
    butt.layer.cornerRadius = 18;
    butt.layer.masksToBounds = YES;
    [self.lowerPartView addSubview:butt];
    

    
    
    
}






//- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
//    
//    
//    
//    
//}



#pragma  mark   --------- 地址管理
- (void)buttonTap {
    
    HWNewAddressViewController *newAddress = [[HWNewAddressViewController alloc]init];
    [self.navigationController pushViewController:newAddress animated:YES];
    
    
    
}


@end
